package com.steakliu.sun.boot.starter.helper;

import com.steakliu.sun.constant.SpringBootStarterConstant;
import org.springframework.core.env.Environment;

/**
 * 功能说明：
 * <p>
 * Original @Author: steakliu-刘牌, 2023-01-05  09:47
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
public class PropertiesHelper {

  private static Environment environment;
  private static final PropertiesHelper INSTANCE = new PropertiesHelper();
  private static final String PROPERTY_PREFIX = SpringBootStarterConstant.CLIENT_YML_PREFIX + SpringBootStarterConstant.SYMBOL;

  public static PropertiesHelper getInstance(Environment environment) {
    PropertiesHelper.environment = environment;
    return INSTANCE;
  }

  public String getProperty(String property) {
    return environment.getProperty(PROPERTY_PREFIX + property);
  }
}
